<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ include file="/common/taglibs.jsp"%>
<%@ include file="/common-app/taglibs.jsp"%>
<%@ taglib uri="/WEB-INF/runqianReport.tld" prefix="report" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<!DOCTYPE html>
<html>
<head>
<title>在填申请项目查询</title>
<script type="text/javascript" src="${res}/js/proposal/irisPrpPrepare.js"></script>
<script type="text/javascript" src="${res_app}/js/app/proposal/irisPrpPrepare.js"></script>
<script type="text/javascript" src="${res_app}/js/report/irisReport.js"></script>

<style type="text/css">
.scrollDivBody
{
	overflow-x: auto;
	overflow-y: hidden;
	BACKGROUND-COLOR: #ffffff; 
	SCROLLBAR-FACE-COLOR: #CFDDF0; 
	SCROLLBAR-SHADOW-COLOR: #CFDDF0; 
	SCROLLBAR-3DLIGHT-COLOR: #CFDDF0; 
	SCROLLBAR-ARROW-COLOR: #CFDDF0;
}
.input-line{
	BORDER-RIGHT: 1px solid #495172;
	PADDING-RIGHT: 1px;
	BORDER-TOP: 1px ridge #819AD2;
	PADDING-LEFT: 1px;
	FONT-SIZE: 9pt;
	PADDING-BOTTOM: 1px;
	BORDER-LEFT: 1px ridge #819AD2;
	COLOR: #0C2358;
	PADDING-TOP: 2px;
	BORDER-BOTTOM: 1px solid #495172;
	HEIGHT: 21px;
	BACKGROUND-COLOR: #FFFFFF;
	text-decoration:underline;
}

</style>
<script type="text/javascript">
    
    //防止查询条件出现乱码
    $(function() {	
	    var in_params = '${v_in_params}';
	    var in_param = in_params.split(',');
	    for ( var i = 0; i < in_param.length; i++) {
	    	var param = in_param[i].split('=');
	    	$("#" + param[0]).val(param[1]);
	    	$("input[name="+ param[0] +"]").val(param[1]);
		}
	    var v = collectData();
	    $("#searchString").val(v['searchString']);
	    $("input[name='searchString']").val(v['searchString']);
    });
    

    function requiredReport() {
	   setValue();
	   $("#mainForm").submit();
    }
     
	function collectData() {
		var requiredConditionHid = document.getElementById("requiredConditionHid").value;
		var querySels = [];
		var queryTableObj = $("#" + requiredConditionHid + " *[id='_dyn_panel']");
		$("[id^='_dyn_criteria'][id$='_field']", queryTableObj).each(
			function() {
				querySels.push($(this).attr('id'));
			});
		
		var queryKVStr = '';
		for ( var i = 0; i < querySels.length; i++) {
			var selId = querySels[i];
			var queryId = $("#"+requiredConditionHid).find('#' + selId).val();
			var destContral = $("#"+requiredConditionHid).find('#' + queryId, $('#' + selId).parent().next());
			var queryValue = destContral.val();
			var queryCellValue = $.trim(queryValue);
			if (!!queryCellValue) {
				if (destContral.is("select")) {
					//var queryText = destContral.find("option:selected").text();
					queryKVStr += '[tear]' + queryId + ':' + queryValue;
					//queryKVStr += '[tear]' + queryId + '_name' + ':' + queryText;
				} else {
					queryKVStr += '[tear]' + queryId + ':' + queryCellValue;
				}
			}
		}
	
		var sdata = {};
		sdata['searchString'] = queryKVStr == '' ? '' : queryKVStr.substring(6);
		return sdata;
	}
	
	function setValue() {
		var v = collectData();
		$("#searchString").val(v['searchString']);
	}
	
	
</script>
</head>
<body>
	<input type="hidden" id="childDiv" class="thickbox" />
	<form method="post" id="mainForm" action="${ctx}/prpapprove/show-single-report?param=requird&idRaq=<iris:des3 code="${idRaq }"></iris:des3>">
		<input type="hidden" id="prpCodes" name="prpCodes" value="" />
		<input type="hidden" id="type" name="type" value="" />
		<input type="hidden" id="idRaq" name="idRaq" value="${idRaq}" />
		<input type="hidden" id="searchString" name="searchString" value="" />
	<br/>
	<div class="soBox">
		<div class="detail ico_search">
			<table>
				<tr>
					<td rowspan="2"><strong>检索条件：</strong>
					</td>
					<td>
						<cpt:search key="${requiredCondition}"
								businessKey=""  displayCount="5" repeatColumn="3"
								sqlConditionStr="{'roleId': '${roleId }'}"></cpt:search></td>
				</tr>
				<tr>
					<td><input type="hidden" name="search_flag" id="search_flag" value="${requiredCondition}"/>
						<input type="hidden" name="requiredConditionHid" id="requiredConditionHid" value="${requiredCondition }"/>
					</td>
				</tr>
				<tr>
					<td>
						<div class="clear_h10"></div>
						<input type='button' id='searchBt' class="button_an" value='查询' onclick="requiredReport()" />
					</td>
				</tr>
			</table>
		</div>
	</div>
	</form>
	<div style="height: 20px;">&nbsp;</div>
	<div class="clear_h10" style="height: 40px;" align="center">
		<!-- <input type="button" class="button" value="存为PDF" onclick="detailForm_saveAsPdf()" /> -->
		<!--<input type="button" class="button" value="存为word" onclick="detailForm_saveAsWord()" />-->
		<input type="button" class="button" value="存为Excel" onclick="detailForm_saveAsExcel()" />
	</div>
	<div align="center" style="width: 100%">
	<table>
		<tr align="center">
			<td align="center">		
			<c:if test="${idRaq ne 11}">
				<report:html name="detailForm" reportFileName="${reportTable}"
						width="-1"
						height="-1"
						funcBarLocation="boTh"
						functionBarColor="#fff5ee"
						funcBarFontSize="9pt"
						funcBarFontColor="blue"
						separator="&nbsp;&nbsp;"
						needSaveAsExcel="no"
						needSaveAsPdf="no"
						needSaveAsWord="no"
						needPrint="no"
						printLabel="打印"
						params="${params}"
						saveAsName="${saveAsName}"
						needPageMark="no"
						firstPageLabel="<span class='pageinfo'>[首 &nbsp;页]</span>" 
						prevPageLabel="<span class='pageinfo'>上一页</span>" 
						nextPageLabel="<span class='pageinfo'>下一页</span>" 
						lastPageLabel="<span class='pageinfo'>[最后页]</span>"
						pageMarkLabel="<span class='pageinfo'>第{currPage}页 共{totalPage}页</span>"					
						displayNoLinkPageMark="yes"/>
	      </c:if>
	      <c:if test="${idRaq eq 11}">
	      <report:html name="detailForm" reportFileName="${reportTable}"
			width="-1"
			height="-1"
			funcBarLocation="boTh"
			functionBarColor="#fff5ee"
			funcBarFontSize="9pt"
			funcBarFontColor="blue"
			separator="&nbsp;&nbsp;"
			needSaveAsExcel="no"
			needSaveAsPdf="no"
			needSaveAsWord="no"
			needPrint="no"
			printLabel="打印"
			params="${params}"
			saveAsName="${saveAsName}"
			needPageMark="no"
			firstPageLabel="<span class='pageinfo'>[首 &nbsp;页]</span>" 
			prevPageLabel="<span class='pageinfo'>上一页</span>" 
			nextPageLabel="<span class='pageinfo'>下一页</span>" 
			lastPageLabel="<span class='pageinfo'>[最后页]</span>"
			pageMarkLabel="<span class='pageinfo'>第{currPage}页 共{totalPage}页</span>"					
			displayNoLinkPageMark="yes"
		/>
	      </c:if>
	      
			</td>
		</tr>
	</table>
	<br>
	</div>
	
</body>
</html>